package cn.wolfcode.crm.domain;

import com.alibaba.fastjson.JSON;
import lombok.Data;

import java.util.Date;
import java.util.HashMap;

@Data
public class Customer {
    public static final int STATUS_COMMON = 0;
    public static final int STATUS_NORMAL = 1;
    public static final int STATUS_FALL = 2;
    public static final int STATUS_LOST = 3;
    public static final int STATUS_POOL = 4;

    //状态值
    private Integer status = STATUS_COMMON;

    public String getStatusName() {
        String temp = "潜在客户";
        switch (status) {
            case STATUS_NORMAL:
                temp = "正式客户";
                break;
            case STATUS_FALL:
                temp = "开发失败客户";
                break;
            case STATUS_LOST:
                temp = "流失客户";
                break;
            case STATUS_POOL:
                temp = "客户池";
                break;
        }
        return temp;
    }

    private Long id;

    private String name;

    private Integer age;

    //性别
    private Integer gender;

    //电话
    private String tel;

    //qq
    private String qq;

    //工作
    private SystemDictionaryItem job;

    //来源
    private SystemDictionaryItem source;

    //销售人员
    private Employee seller;

    //录入人
    private Employee inputuser;

    //录入时间
    private Date inputTime;


    public String getJson() {
        HashMap map = new HashMap();
        map.put("id", id);
        map.put("name", name);
        map.put("age", age);
        map.put("gender", gender);
        map.put("tel", tel);
        map.put("qq", qq);
        if (source != null) {
            map.put("source", source.getId());
        }
        if (job != null) {
            map.put("job", job.getId());
        }
        //在客户移交的时候，需要用到销售人员的id 和 名字
        if (seller != null){
            map.put("sellerName", seller.getName());
            map.put("sellerId", seller.getId());
        }
        return JSON.toJSONString(map);
    }



}